---
title: How to set up a redirect for your custom domain on Dub
updatedAt: 2023-07-26
summary: Learn how to redirect your custom domain to a URL of your choice on Dub.
author: steventey
categories:
  - custom-domains
related:
  - how-to-add-custom-domain
  - what-is-a-project
  - pro-plan
---

<Note variant="success">
  This feature is only available for [Pro plans and above](pro-plan).
</Note>

When you add a custom domain to your project, Dub will automatically create a placeholder page for your domain. This page will be displayed when you visit your domain.

## Redirecting your domain

To redirect your domain to a URL of your choice, follow these steps:

1. If you haven't already, [upgrade to the Pro plan](pro-plan).
2. Navigate to your project's Domains page – you can do that by clicking on the **Domains** link in the menu bar at the top of your project dashboard.
3. Click on the **Edit** button next to the domain you want to redirect to open up the Domain Settings modal.
4. Enter the URL you want to redirect your domain to in the **Landing Page** field.
5. Click "Save changes".

<Image
  alt="The 'Domain Settings' modal in Dub"
  src="https://d2vwwcvoksz7ty.cloudfront.net/help/domain-settings-modal.png"
  width={1146}
  height={755}
/>

## Rewriting your domain (URL masking / cloaking)

In certain cases, you might want to rewrite your domain to a given URL (also known as URL masking or cloaking).

<Image
  alt="Masking 'youtube.com/@stey' with 'steven.yt'"
  src="https://d2vwwcvoksz7ty.cloudfront.net/help/rewrite-domain-example.png"
  width={811}
  height={525}
/>

You can do that simply by setting the **Behavior** field of your custom domain to "Rewrite" in the Domain Settings modal:

<Image
  alt="Setting the behavior of a domain to 'Rewrite'"
  src="https://d2vwwcvoksz7ty.cloudfront.net/help/rewrite-domain-modal.png"
  width={1182}
  height={697}
/>

A few caveats for the URL masking feature:

1. This feature is only available for [Pro plans and above](pro-plan).
2. URL masking might not work for certain websites that have security measures in place to prevent this (e.g. `twitter.com`). Potential errors include:
   - The domain redirects instead of rewriting
   - Domain keeps redirecting (`ERR_TOO_MANY_REDIRECTS`)
3. For certain [Next.js](https://nextjs.org/) websites, URL masking might cause broken CSS styles (e.g. `ray.so`)
